package com.trip.api;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * @author hc24
 * @version 2017/9/28
 */
@Controller
public class TestController {

    @RequestMapping("test/1")
    public String test1(){
        return "test1";
    }

    @RequestMapping("test/2")
    public ResponseEntity<String> test2(){
        return ResponseEntity.ok("test2 response");
    }

    @RequestMapping("test/22")
    @ResponseBody
    public String test22(){
        return "test 22";
    }

    @RequestMapping("test/3")
    public ResponseEntity<UserVo> test3(){
        return ResponseEntity.ok(new UserVo());
    }

    public String test4(HttpSession session){
        return null;
    }

    class UserVo{
        private String username="aha";
        private Integer age=30;

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public Integer getAge() {
            return age;
        }

        public void setAge(Integer age) {
            this.age = age;
        }
    }
}
